export default Array.prototype.myReduce = function(cb, initialValue) {
    if (typeof cb !== 'function') {
        throw TypeError(`callback is not a function`)
    }
    let arr = this
    let res = initialValue || arr[0]
    for (let i = initialValue ? 0 : 1; i < arr.length; i++) {
        res = cb(res, arr[i], i, arr)
    }
    return res
}